//
//  HEOrderTitleCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/18.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEOrderTitleCell.h"

@interface HEOrderTitleCell ()

@property (nonatomic, strong) UILabel *titleLb;

@property(nonatomic, strong) UIButton *leftLabel;
@end

@implementation HEOrderTitleCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    // 姓名
//    _titleLb = [UILabel new];
//    _titleLb.text = @"-";
//    _titleLb.font = DYBlodFont(18);
//    [self.contentView addSubview:_titleLb];
    
    _leftLabel = [UIButton new];
    [self.contentView addSubview:_leftLabel];
    _leftLabel.userInteractionEnabled = NO;
    _leftLabel.titleLabel.font = DYBlodFont(17);
    _leftLabel.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, 0);
    _leftLabel.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
    [_leftLabel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_leftLabel setImage:[UIImage imageNamed:@"3"] forState:UIControlStateNormal];
    [_leftLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    
    _leftLabel.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    _leftLabel.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    
    [_leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(15);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.bottom.equalTo(self.contentView).mas_offset(-0);
    }];
}

- (void)configCellWithModel:(id)model fiterModel:(GDFiterCellModel *)fiterModel indexPath:(NSIndexPath *)indexPath {
    [_leftLabel setTitle:fiterModel.leftTitle forState:UIControlStateNormal];
    [_leftLabel setImage:(fiterModel.isHasMustSigns?[UIImage imageNamed:@"3"]: nil) forState:UIControlStateNormal];
}

- (void)refreshContent:(GDFiterCellModel *)fiterModel formModel:(GDFormModel *)formModel indexPath:(NSIndexPath *)indexPath {
    [_leftLabel setTitle:fiterModel.leftTitle forState:UIControlStateNormal];
    [_leftLabel setImage:(fiterModel.isHasMustSigns?[UIImage imageNamed:@"3"]: nil) forState:UIControlStateNormal];
}

@end
